from openai import OpenAI
from dotenv import load_dotenv, find_dotenv
import os
_ = load_dotenv(find_dotenv())


# OPENAI_API_KEY = 'sk-2qHMgOvsbppxJM11ea5oPgWtFtpViu5ghl7QlsLN8CPHdpGn'

# client = OpenAI(
#   api_key=OPENAI_API_KEY,
#   base_url='https://api.fe8.cn/v1' # 默认是https://api.openai.com/v1
# )

client = OpenAI()

completion = client.chat.completions.create(
  model="gpt-4o-mini",
  # model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "你是一个笑话大师。"},
    {"role": "user", "content": "讲一个好笑的笑话。"}
  ]
)

print(completion.choices[0].message);
